//
//  LGFindGenCreateNewViewController.m
//  ligenyun
//
//  Created by Mac on 2018/4/4.
//  Copyright © 2018年 stoneobs@icloud.com. All rights reserved.
//

#import "LGFindGenCreateNewViewController.h"
#import "LGMenuTextFiledView.h"
#import "LGTypeChosedControl.h"
@interface LGFindGenCreateNewViewController ()
@property(nonatomic, strong) LGMenuTextFiledView                     *titleView;
@property(nonatomic, strong) LGTypeChosedControl                     *cateControl;
@property(nonatomic, strong) LGMenuTextFiledView                     *laiyuanView;
@property(nonatomic, strong) LGMenuTextFiledView                     *luruView;
@property(nonatomic, strong) LGMenuTextFiledView                     *zuozheView;
@property(nonatomic, strong) LGMenuTextFiledView                     *neirongView;
@property(nonatomic, strong) STButton                                *authPwdButton;

@end

@implementation LGFindGenCreateNewViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"创建寻根";
    [self.tableView st_autoAdjustAllResponder];
    self.tableView.backgroundColor = [UIColor whiteColor];
    [self configSubView];
    // Do any additional setup after loading the view.
}

#pragma mark --subView
- (void)configSubView{
    UIView * header = [[UIView alloc] initWithFrame:CGRectMake(0, 0, UIScreenWidth, 30)];
    
    CGFloat with =self.tableView.width - 20;
    CGFloat height = 35;
    
    self.titleView = [[LGMenuTextFiledView alloc] initWithFrame:CGRectMake(10, 30, with, height) leftTitle:@"标题:"];
    [header addSubview:self.titleView];
    
    __weak typeof(self) weakSelf =  self;
    STLabel * indicatiorLable = [[STLabel alloc] initWithFrame:CGRectMake(15, self.titleView .bottom  +10, 200, 30)
                                                          text:@"类别:"
                                                     textColor:SecendTextColor
                                                          font:14
                                                   isSizetoFit:NO
                                                 textAlignment:NSTextAlignmentRight];
    [NSString lableAutoAdjustWitdhWithLabel:indicatiorLable];
    indicatiorLable.right = self.titleView.titleLable.right + 10;
    [header addSubview:indicatiorLable];
    
    
    self.cateControl = [[LGTypeChosedControl alloc] initWithFrame:CGRectMake(indicatiorLable.right + 10, self.titleView.bottom + 10, self.titleView.textFiled.width, 35)
                                                            title:@"请选择分类"];
    [self.cateControl setClction:^(LGTypeChosedControl *control) {
        [weakSelf onSectedCateControl];
    }];
    [header addSubview:self.cateControl];
    
    self.laiyuanView = [[LGMenuTextFiledView alloc] initWithFrame:CGRectMake(10, self.cateControl.bottom + 10, with, height) leftTitle:@"来源:"];
    [header addSubview:self.laiyuanView];
    
    self.luruView = [[LGMenuTextFiledView alloc] initWithFrame:CGRectMake(10, self.laiyuanView.bottom + 10, with, height) leftTitle:@"录入:"];
    [header addSubview:self.luruView];
    
    self.zuozheView = [[LGMenuTextFiledView alloc] initWithFrame:CGRectMake(10, self.luruView.bottom + 10, with, height) leftTitle:@"作者:"];
    [header addSubview:self.zuozheView];
    
    self.neirongView = [[LGMenuTextFiledView alloc] initWithFrame:CGRectMake(10, self.zuozheView.bottom + 10, with, height * 3) leftTitle:@"内容:"];
    [header addSubview:self.neirongView];
    
    
    STLabel * quanxianLable = [[STLabel alloc] initWithFrame:CGRectMake(15, self.neirongView.bottom  +10, 200, 30)
                                                          text:@"权限:"
                                                     textColor:SecendTextColor
                                                          font:14
                                                   isSizetoFit:NO
                                                 textAlignment:NSTextAlignmentRight];
    [NSString lableAutoAdjustWitdhWithLabel:quanxianLable];
    quanxianLable.right = self.titleView.titleLable.right + 10;
    [header addSubview:quanxianLable];
    
    self.authPwdButton = [[STButton alloc] initWithFrame:CGRectMake(quanxianLable.right + 10, self.neirongView.bottom  +10 +10, UIScreenWidth - 40, 44)
                                                   title:@"只允许自己查看"
                                              titleColor:SecendTextColor
                                               titleFont:15
                                            cornerRadius:0
                                         backgroundColor:nil
                                         backgroundImage:nil
                                                   image:[UIImage imageNamed:@"icon_勾选_未选中"]];
    self.authPwdButton.titleEdgeInsets= UIEdgeInsetsMake(0, 10, 0, 0);
    self.authPwdButton.centerY = quanxianLable.centerY;
    [self.authPwdButton setImage:[UIImage imageNamed:@"icon_勾选_选中"] forState:UIControlStateSelected];
    [self.authPwdButton setClicAction:^(UIButton *sender) {
        sender.selected = !sender.selected;
    }];
    [header addSubview:self.authPwdButton];
    
    
    header.height = self.authPwdButton.bottom;
    self.tableView.tableHeaderView = header;
    
    
    STButton * sendButton = [TMUtils deflutNextButton];
    [sendButton setClicAction:^(UIButton *sender) {
        [weakSelf onSectedSendButton];
    }];
    [sendButton setTitle:@"发布" forState:UIControlStateNormal];
    [self.view addSubview:sendButton];

}
#pragma mark --Action Method
- (void)onSectedCateControl{
    
}
- (void)onSectedSendButton{
    
}
@end
